function fib(n: number): number {
  if (n < 2) return n;

  const memo: number[] = [0, 1];

  for (let i = 2; i <= n; i++) {
    if (i <= 1) {
      memo[i] = i;
      continue;
    }

    memo[i] = memo[i - 1] + memo[i - 2];
  }

  return memo[n];
}

console.log(fib(10)); // 55

export {};
